package cn.crm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.crm.Service.IPermissionService;
import cn.crm.common.ServerResponse;
import cn.crm.entity.Permission;

@Controller
@RequestMapping(value="permission")
public class PermissionController {
	
	@Autowired
	private IPermissionService permissionservice;
	
	@RequestMapping(value="selectAllpermissions")
	@ResponseBody
	public ServerResponse selectAllpermissions(){
		return permissionservice.selectAllpermissions();
	}
	
	@RequestMapping(value="topermissionpage")
	public String topermissionpage(){
		return "permission/permission_list";
	}
	
	@RequestMapping(value="pageList")
	@ResponseBody
	public ServerResponse pageList(Integer page,Integer limit,Permission permission){
		return permissionservice.pageList(page,limit,permission);
	}
	
	@RequestMapping(value="insert")
	@ResponseBody
	public ServerResponse insert(Permission permission){
		return permissionservice.insert(permission);
	}
	@RequestMapping(value="toinsertpage")
	public String toinsertpage(){
		return "permission/permission_insert";
	}
	
	
	
}
